package com.example.shardings.ms.controller;

import com.example.shardings.ms.pojo.WechatUser;
import com.example.shardings.ms.service.WechatUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("wechatUser")
public class WechatUserController {
    @Autowired
    private WechatUserService wechatUserService;

    @GetMapping("/getAll")
    public ResponseEntity<List<WechatUser>> getAll(){
        return ResponseEntity.ok(wechatUserService.getAll());
    }

    @GetMapping("/getById")
    public ResponseEntity<List<WechatUser>> getById(@RequestParam("id") Long id){
        return ResponseEntity.ok(wechatUserService.getById(id));
    }
    @GetMapping("/initDate")
    public ResponseEntity<List<WechatUser>> getAll(@RequestParam("total") Integer total){
        return ResponseEntity.ok(wechatUserService.initDate(total));
    }
}
